package com.ccq.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.ccq.domain.FieldBase;
import com.ccq.domain.User;
import com.ccq.repository.UserMapper;

@Service
public class UserService {
	@Autowired
	private UserMapper userMapper;

	@Cacheable(value = "userCache", keyGenerator = "KeyGenerator")
	public User findByName(String name) {
		return userMapper.findByName(name);
	}

	public int insert(String name, int age) {
		return userMapper.insert(name, age);
	}
	@Cacheable(value = "userCache", keyGenerator = "KeyGenerator")
//	@Cacheable(value = "userCache", key = "'key:'+#id.toString()")
	public User selectById(int id) {
		return userMapper.selectUser(id);
	}
}
